﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using WPFExcelReport.Helpers;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public partial class TP08SJ
    {
        public TP08SJ()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VTXTKON();
            this.DataContext = MV;
            InitializeComponent();
          
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            base.Window_Loaded(sender, e);
            TP = "97";
        }
        public override void SaveCommand(object sender, RoutedEventArgs e)
        {
            TPSave(MV.date, app.User, 0, 10, false);
            base.SaveCommand(sender, e);
        }
        public override void PINDLOAD(string pind)
        {
            TBMain.Clear();
            ReSetTXT();
            if (pind.Length == 0)
                return;
            dwData = TBMain.NewRow();
            dwData["TXTKMANDANT"] = app.Mandant;
            dwData["TXTKPIND"] = pind;
            dwData["TXTKFILLER"] = " AND TXTKFILLER='" + TP + "'";
            SResult = TMV.QueryTXTKON(dwData, 5);
            MergeData(SResult, true, true);
            GetTPTxt();
           
            DEFTPTEXT();
        }
        public override void DEFTPTEXT()
        {
            if (TBMain.Rows.Count > 0)
                return;
            if (IsEdit)
            {
                string txt = "";
                txt = "1201-ZC";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = Helper.ConvertGB2312To8859P1("1201-筘幅________，纬密________，机型________");//备注
                TMV.InsertLine(txt);
                txt = "1202-ND";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1202-   ";//备注
                TMV.InsertLine(txt);
                txt = "1203-ND";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1203-   ";//备注
                TMV.InsertLine(txt);
                txt = "1204-ND";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1204-    ";//备注
                TMV.InsertLine(txt);

                txt = "1205-TY";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1205-   ";//备注
                TMV.InsertLine(txt);
                txt = "1206-  ";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1206-   ";//备注
                TMV.InsertLine(txt);
                txt = "1207-  ";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1207-   ";//备注
                TMV.InsertLine(txt);
                txt = "1208-  ";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1208-   ";//备注
                TMV.InsertLine(txt);
                txt = "1209-  ";//+ MV.date + app.User;
                TMV.InsertLine(txt);
                txt = "1209-   ";//备注
                TMV.InsertLine(txt);
                TMV.POSTCHG();
            }
            GetTPTxt();  
        }
    }
}
